
public class BubleViewUtil  {

    public LinearLayout getLoactionView(String weizhi,boolean isSelf){
        LinearLayout linearLayout = new LinearLayout(MyApplication.getContext());
        if(isSelf){
            linearLayout.setBackgroundResource(R.drawable.chat_r2);
        }else {
            linearLayout.setBackgroundResource(R.drawable.chat_l2);
        }
        LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(PxUtil.LOCA_w, ViewGroup.LayoutParams.WRAP_CONTENT);
        linearLayout.setLayoutParams(layoutParams);
        linearLayout.setOrientation(LinearLayout.VERTICAL);
        linearLayout.setGravity(Gravity.CENTER);

            TextView tv = new TextView(MyApplication.getContext());
            tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
            tv.setPadding(MyApplication.locaP,MyApplication.locaP,MyApplication.locaP,MyApplication.locaP/3);
            tv.setTextColor(0xff313131);
            tv.setText(weizhi);

            RelativeLayout relativeLayout=new RelativeLayout(MyApplication.getContext());
            LinearLayout.LayoutParams layoutParams2=new LinearLayout.LayoutParams(MyApplication.LOCA_w, MyApplication.LocaH);
            relativeLayout.setLayoutParams(layoutParams2);

            ImageView roundImageView=new ImageView(MyApplication.getContext());
            RelativeLayout.LayoutParams layoutParams3=new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
            roundImageView.setLayoutParams(layoutParams3);
            roundImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
            roundImageView.setImageResource(R.drawable.wx_ditu01);
            relativeLayout.addView(roundImageView);

            ImageView roundImageView2=new ImageView(MyApplication.getContext());
            RelativeLayout.LayoutParams layoutParams4=new RelativeLayout.LayoutParams(MyApplication.locI,MyApplication.locI);
            layoutParams4.addRule(RelativeLayout.CENTER_IN_PARENT,RelativeLayout.TRUE);
            roundImageView2.setLayoutParams(layoutParams4);
            roundImageView2.setImageResource(R.drawable.wx_dingweiloh);
            relativeLayout.addView(roundImageView2);

        linearLayout.addView(tv);
        linearLayout.addView(relativeLayout);
        return linearLayout;
    }


    public GifImageView gifImageView(String index){

        GifImageView gifImageView=new GifImageView(MyApplication.getContext());
        RelativeLayout.LayoutParams layoutParams=new RelativeLayout.LayoutParams(PxUtil.GifWH, PxUtil.GifWH);
        gifImageView.setLayoutParams(layoutParams);
        if(index.equals("0")){
            gifImageView.setImageResource(R.drawable.g01);
        }else if(index.equals("1")){
            gifImageView.setImageResource(R.drawable.g02);
        }else if(index.equals("2")){
            gifImageView.setImageResource(R.drawable.g03);
        }else if(index.equals("3")){
            gifImageView.setImageResource(R.drawable.g04);
        }else if(index.equals("4")){
            gifImageView.setImageResource(R.drawable.g05);
        }else if(index.equals("5")){
            gifImageView.setImageResource(R.drawable.g06);
        }else if(index.equals("6")){
            gifImageView.setImageResource(R.drawable.g07);
        }else if(index.equals("7")){
            gifImageView.setImageResource(R.drawable.g08);
        }
        return gifImageView;
    }

    public LinearLayout shoudaohb_view(int a){
        LinearLayout linearLayout = new LinearLayout(MyApplication.getContext());
        LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(PxUtil.BUBLE_ZZ_W, PxUtil.BUBLE_ZZ_H);
        if(a==0){
            linearLayout.setBackgroundResource(R.drawable.wx_shou_mee);
            layoutParams.setMargins(0,0,PxUtil.a3,0);
        }else {
            linearLayout.setBackgroundResource(R.drawable.wx_shou_he);
            layoutParams.setMargins(PxUtil.a3,0,0,0);
        }
        linearLayout.setLayoutParams(layoutParams);
        linearLayout.setOrientation(LinearLayout.VERTICAL);
            LinearLayout l_top =new LinearLayout(MyApplication.getContext());
            LinearLayout.LayoutParams lp2=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,0,3);
            l_top.setLayoutParams(lp2);
            l_top.setGravity(Gravity.CENTER_VERTICAL);
            l_top.setOrientation(LinearLayout.HORIZONTAL);
            l_top.addView(sdhb_top_img(a));
            l_top.addView(hbsd_top_text(a));
                TextView ttt=new TextView(MyApplication.getContext());
                ttt.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,0,1));
                ttt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 9);
                ttt.setTextColor(0xff989898);
                ttt.setGravity(Gravity.CENTER_VERTICAL);
                ttt.setText("微信红包");
        linearLayout.addView(l_top);
        linearLayout.addView(ttt);

        return linearLayout;
    }

    public LinearLayout shoudao_view(int a,String qian,boolean isup){
        LinearLayout linearLayout = new LinearLayout(MyApplication.getContext());
        LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(PxUtil.BUBLE_ZZ_W, PxUtil.BUBLE_ZZ_H);
        if(a==0){
            linearLayout.setBackgroundResource(R.drawable.wx_shou_mee);
            layoutParams.setMargins(0,0,PxUtil.a3,0);
        }else {
            linearLayout.setBackgroundResource(R.drawable.wx_shou_he);
            layoutParams.setMargins(PxUtil.a3,0,0,0);
        }
        linearLayout.setLayoutParams(layoutParams);
        linearLayout.setOrientation(LinearLayout.VERTICAL);
            LinearLayout l_top =new LinearLayout(MyApplication.getContext());
            l_top.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,0,3));
            l_top.setGravity(Gravity.CENTER_VERTICAL);
            l_top.setOrientation(LinearLayout.HORIZONTAL);
            l_top.addView(sd_top_img(a));
            l_top.addView(sd_top_text(a,qian,isup));
                TextView ttt=new TextView(MyApplication.getContext());
                ttt.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,0,1));
                ttt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 9);
                ttt.setTextColor(0xff989898);
                ttt.setGravity(Gravity.CENTER_VERTICAL);
                ttt.setText("微信转账");
        linearLayout.addView(l_top);
        linearLayout.addView(ttt);

        return linearLayout;
    }

    public LinearLayout hongbao_view(int a){
        LinearLayout linearLayout = new LinearLayout(MyApplication.getContext());
        LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(PxUtil.BUBLE_ZZ_W, PxUtil.BUBLE_ZZ_H);
        if(a==0){
            linearLayout.setBackgroundResource(R.drawable.wx_zhuangzhang_me);
            layoutParams.setMargins(0,0,PxUtil.a3,0);
        }else {
            linearLayout.setBackgroundResource(R.drawable.wx_zhuanzhang_he);
            layoutParams.setMargins(PxUtil.a3,0,0,0);
        }
        linearLayout.setLayoutParams(layoutParams);
        linearLayout.setOrientation(LinearLayout.VERTICAL);
            LinearLayout l_top =new LinearLayout(MyApplication.getContext());
            l_top.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,0,3));
            l_top.setGravity(Gravity.CENTER_VERTICAL);
            l_top.setOrientation(LinearLayout.HORIZONTAL);
            l_top.addView(hb_top_img(a));
            l_top.addView(hb_top_text(a));
                TextView ttt=new TextView(MyApplication.getContext());
                ttt.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,0,1));
                ttt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 9);
                ttt.setTextColor(0xff989898);
                ttt.setGravity(Gravity.CENTER_VERTICAL);
                ttt.setText("微信红包");
        linearLayout.addView(l_top);
        linearLayout.addView(ttt);

        return linearLayout;
    }

    public LinearLayout sb(int a,String qian){
        LinearLayout linearLayout = new LinearLayout(MyApplication.getContext());
        LinearLayout.LayoutParams layoutParams=new LinearLayout.LayoutParams(PxUtil.BUBLE_ZZ_W, PxUtil.BUBLE_ZZ_H);
        if(a==0){
            linearLayout.setBackgroundResource(R.drawable.wx_zhuangzhang_me);
            layoutParams.setMargins(0,0,MyApplication.a3,0);
        }else {
            linearLayout.setBackgroundResource(R.drawable.wx_zhuanzhang_he);
            layoutParams.setMargins(MyApplication.a3,0,0,0);
        }
        linearLayout.setLayoutParams(layoutParams);
        linearLayout.setOrientation(LinearLayout.VERTICAL);
            LinearLayout l_top =new LinearLayout(MyApplication.getContext());
            l_top.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,0,3));
            l_top.setGravity(Gravity.CENTER_VERTICAL);
            l_top.setOrientation(LinearLayout.HORIZONTAL);
            l_top.addView(zz_top_img(a));
            l_top.addView(zz_top_text(a,qian));
                TextView ttt=new TextView(MyApplication.getContext());
                ttt.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,0,1));
                ttt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 9);
                ttt.setTextColor(0xff989898);
                ttt.setGravity(Gravity.CENTER_VERTICAL);
                ttt.setText("微信转账");
                linearLayout.addView(l_top);
                linearLayout.addView(ttt);
        return linearLayout;
    }

    public ImageView zz_top_img(int a){
        ImageView zzico=new ImageView(MyApplication.getContext());
        LinearLayout.LayoutParams ico_p=new LinearLayout.LayoutParams(PxUtil.img_size,PxUtil.img_size);
        if(a==0){
            ico_p.setMargins(PxUtil.a1,0,0,0);
        }else {
            ico_p.setMargins(PxUtil.a2,0,0,0);
        }
        zzico.setLayoutParams(ico_p);
        zzico.setImageResource(R.drawable.ic_zhuanzhang);
        return zzico;
    }
    public ImageView hb_top_img(int a){
        ImageView zzico=new ImageView(MyApplication.getContext());
        LinearLayout.LayoutParams ico_p=new LinearLayout.LayoutParams(PxUtil.img_size,PxUtil.img_size);
        if(a==0){
            ico_p.setMargins(PxUtil.a1,0,0,0);
        }else {
            ico_p.setMargins(PxUtil.a2,0,0,0);
        }
        zzico.setLayoutParams(ico_p);
        zzico.setImageResource(R.drawable.wx_money_hb);
        return zzico;
    }
    public ImageView sd_top_img(int a){
        ImageView zzico=new ImageView(MyApplication.getContext());
        LinearLayout.LayoutParams ico_p=new LinearLayout.LayoutParams(PxUtil.img_size,PxUtil.img_size);
        if(a==0){
            ico_p.setMargins(PxUtil.a1,0,0,0);
        }else {
            ico_p.setMargins(PxUtil.a2,0,0,0);
        }
        zzico.setLayoutParams(ico_p);
        zzico.setImageResource(R.drawable.icon_wechat_shouqian_icon);
        return zzico;
    }
    public ImageView sdhb_top_img(int a){
        ImageView zzico=new ImageView(MyApplication.getContext());
        LinearLayout.LayoutParams ico_p=new LinearLayout.LayoutParams(PxUtil.img_size,PxUtil.img_size);
        if(a==0){
            ico_p.setMargins(PxUtil.a1,0,0,0);
        }else {
            ico_p.setMargins(PxUtil.a2,0,0,0);
        }
        zzico.setLayoutParams(ico_p);
        zzico.setImageResource(R.drawable.wx_money_hb22);
        return zzico;
    }

    public LinearLayout zz_top_text(int a,String qian){
        LinearLayout sbb=new LinearLayout(MyApplication.getContext());
        LinearLayout.LayoutParams lp_sbb=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
        lp_sbb.setMargins(PxUtil.BUBLE_ZZ_MAR_LEFT,0,0,0);
        sbb.setLayoutParams(lp_sbb);
        sbb.setOrientation(LinearLayout.VERTICAL);
            TextView biaoti=new TextView(MyApplication.getContext());
            biaoti.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT););
            biaoti.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
            biaoti.getPaint().setFakeBoldText(true);
            biaoti.setTextColor(0xffffffff);
            if(a==0){
                biaoti.setText("转账给"+MyApplication.getInstance().getNow_name());
            }else {
                biaoti.setText("转账给你");
            }
            sbb.addView(biaoti);

            TextView num=new TextView(MyApplication.getContext());
            LinearLayout.LayoutParams lp_num=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
            lp_num.setMargins(0,PxUtil.BUBLE_ZZ_MAR_TOP,0,0);
            num.setLayoutParams(lp_num);
            num.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
            num.setTextColor(0xffffffff);
            num.setText("¥ "+qian);
            sbb.addView(num);
        return sbb;

    }
    public LinearLayout sd_top_text(int a,String qian,boolean isup){
        LinearLayout sbb=new LinearLayout(MyApplication.getContext());
        LinearLayout.LayoutParams lp_sbb=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
        lp_sbb.setMargins(MyApplication.BUBLE_ZZ_MAR_LEFT,0,0,0);
        sbb.setLayoutParams(lp_sbb);
        sbb.setOrientation(LinearLayout.VERTICAL);
            TextView biaoti=new TextView(MyApplication.getContext());
            LinearLayout.LayoutParams lp_biaoti=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
            biaoti.setLayoutParams(lp_biaoti);
            biaoti.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
            biaoti.getPaint().setFakeBoldText(true);
            biaoti.setTextColor(0xffffffff);
            if(isup){
                biaoti.setText("已被领取");
            }else {
                biaoti.setText("已收钱");
            }
            sbb.addView(biaoti);

            TextView num=new TextView(MyApplication.getContext());
            LinearLayout.LayoutParams lp_num=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
            lp_num.setMargins(0,PxUtil.BUBLE_ZZ_MAR_TOP,0,0);
            num.setLayoutParams(lp_num);
            num.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
            num.setTextColor(0xffffffff);
            num.setText("¥ "+qian);
            sbb.addView(num);
        return sbb;

    }
    private LinearLayout hb_top_text(int a){
        LinearLayout sbb=new LinearLayout(MyApplication.getContext());
        LinearLayout.LayoutParams lp_sbb=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
        lp_sbb.setMargins(MyApplication.BUBLE_ZZ_MAR_LEFT,0,0,0);
        sbb.setLayoutParams(lp_sbb);
        sbb.setOrientation(LinearLayout.VERTICAL);
            TextView biaoti=new TextView(MyApplication.getContext());
            LinearLayout.LayoutParams lp_biaoti=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
            biaoti.setLayoutParams(lp_biaoti);
            biaoti.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
            biaoti.getPaint().setFakeBoldText(true);
            biaoti.setTextColor(0xffffffff);
            biaoti.setText("恭喜发财，大吉大利");
        sbb.addView(biaoti);
        return sbb;
    }
    private LinearLayout hbsd_top_text(int a){
        LinearLayout sbb=new LinearLayout(MyApplication.getContext());
        LinearLayout.LayoutParams lp_sbb=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
        lp_sbb.setMargins(MyApplication.BUBLE_ZZ_MAR_LEFT,0,0,0);
        sbb.setLayoutParams(lp_sbb);
        sbb.setOrientation(LinearLayout.VERTICAL);
            TextView biaoti=new TextView(MyApplication.getContext());
            LinearLayout.LayoutParams lp_biaoti=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
            biaoti.setLayoutParams(lp_biaoti);
            biaoti.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
            biaoti.getPaint().setFakeBoldText(true);
            biaoti.setTextColor(0xffffffff);
            biaoti.setText("恭喜发财，大吉大利");
            sbb.addView(biaoti);

            TextView num=new TextView(MyApplication.getContext());
            LinearLayout.LayoutParams lp_num=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
            lp_num.setMargins(0,PxUtil.BUBLE_ZZ_MAR_TOP,0,0);
            num.setLayoutParams(lp_num);
            num.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
            num.setTextColor(0xffffffff);
            if(a==0){
                num.setText("红包已被领完");
            }else {
                num.setText("红包已领取");
            }
            sbb.addView(num);
        return sbb;
    }
    
}
